﻿using GN.Pay.TradeChannel;
using GN.Pay.TradeChannel.Configure;
using GN.Pay.TradeChannel.DefaultImpl;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace GN.Pay.TradeChannel.WeiXin
{
    /// <summary>
    /// 微信扫码支付
    /// </summary>
    [Serializable]
    public class WeiXinConfigureInfo : TradeChannelConfigureInfo
    {
        /// <summary>
        /// 微信分配的公众账号ID（企业号corpid即为此appId）
        /// </summary>
        public string AppId { get; set; }

        /// <summary>
        /// 微信分配的Key
        /// </summary>
        public string Key { get; set; }       

        private byte[] _RefundCretRaw = null;

        /// <summary>
        /// 退款证书二进制
        /// </summary>
        /// <returns></returns>
        public byte[] RefundCretRaw()
        {
            if (_RefundCretRaw != null)
            {
                return _RefundCretRaw;
            }
            if (string.IsNullOrWhiteSpace(RefundCretRawBase64))
            {
                return null;
            }
            _RefundCretRaw = Convert.FromBase64String(RefundCretRawBase64);
            return _RefundCretRaw;
        }

        private string _RefundCretRawBase64;

        /// <summary>
        /// 退款证书Base64编码
        /// </summary>
        public string RefundCretRawBase64
        {
            get
            {
                return _RefundCretRawBase64;
            }
            set
            {
                _RefundCretRawBase64 = value;
                _RefundCretRaw = null;
            }
        }

    }
}
